﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace ProjectStore30032013.PRESENTATION
{
    public partial class frmLogin : Form
    {

        

        public frmLogin()
        {
            InitializeComponent();
        }        

        #region Members
        int numberLogin = 0; 
        #endregion

        #region Data Structures

        #endregion

        #region Public Methods

        #endregion

        #region Private Methods
        private void danh_nhap_he_thong()
        {
            if (DAL.Controler.testUser(txtUser.Text, txtPass.Text) == true)
            {
                DAL.Controler.UserLogin = txtUser.Text;
                FormMain v_frmMain = new FormMain();
                this.Hide();
                v_frmMain.ShowDialog();
                this.Close();
            }
            else
            {
                m_txt_thong_bao.Text = "Wrong User name or Password!";
                m_txt_thong_bao.Visible = true;
            }
        }        
        #endregion

        #region Events
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                danh_nhap_he_thong();
            }
            catch (Exception v_e)
            {
                MessageBox.Show(v_e.Message);
            }
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        #endregion

        private void chBoxSavePass_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void frmLogin_Load(object sender, EventArgs e)
        {

        }
    }
}
